# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-jsonschema
_pkgname=jsonschema
pkgver=3.2.0
pkgrel=0
pkgdesc="An implementation of JSON Schema validation for Python"
url="https://github.com/Julian/jsonschema"
arch="noarch"
license="MIT"
depends="python3 py3-pyrsistent py3-attrs py3-setuptools py3-six py3-importlib-metadata"
checkdepends="py3-twisted py3-pytest"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-jsonschema" # Backwards compatibility
provides="py-jsonschema=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	python3 -m unittest
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"

	# Add version suffix to executable files.
	local path; for path in "$pkgdir"/usr/bin/*; do
		mv "$path" "$path"-3
	done

	ln -s jsonschema-3 "$pkgdir"/usr/bin/jsonschema
}

sha512sums="acbb4cec730a8cdab9f070593ed896064fbe082d464ec362adc952e4985e9eaa12ad0f2d55a04018ffdaf675e54037999a7219533dad6b84bf609f5dfe21bbab  jsonschema-3.2.0.tar.gz"
